/*
    1. 先确定喊了几次 7
    2. 反推统计时的数字 K 
    3. for 遍历 k
    4. 如果 能 % 7 == 0 或者 包含 7 则当前位置的编号 arr[i % 5]++

*/  
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1000

int isInclude7(int a) {
    char aString[10];
    sprintf(aString, "%d", a);
    int isInclude = 0;
    for(int i = 0; aString[i]; i++) {
        if (aString[i] == '7') {
            isInclude = 1;
            break;
        }
    }
    if (a % 7 == 0 || isInclude) {
        return 1;
    }
    return 0;
}

int main() {
    int num = 0;    // 统计 玩家 的总数
    int *origin = (int *)malloc(sizeof(int) * MAX);
    char *input = (char *)malloc(sizeof(char) * MAX);

    int *actual = (int *)malloc(sizeof(int) * MAX);

    fgets(input, sizeof(char) * MAX, stdin);
    input[strcspn(input, "\n")] = 0;
    char *token = strtok(input, " ");
    while (token != NULL) {
        origin[num++] = atoi(token);
        token = strtok(NULL, " ");
    }

    // 统计喊 7 次数
    int sevenNum = 0;
    for(int i = 0; i < num; i++) {
        sevenNum += origin[i];
    }

    // 反推统计时最小的叫停数 K
    int k = 1;
    int count = sevenNum;
    for(int i = 1; i <= 200 && count != 0; i++) {
        k++;
        if (i % 7 ==0 || isInclude7(i)) {
            count--;
        }
    } 

    // 存放真实的次数
    for(int i = 1; i < k; i++) {
        if (i % 7 == 0 || isInclude7(i)) {
            actual[i % num]++;
        }
    }

    for(int i = 0; i < num; i++) {
        printf("%d ", actual[i]);
    }
    return 0;
}

